package com.itheima.reggie.common;


public class BaseContext {

   private static final ThreadLocal<Long> THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 提供静态方法往当前本地线程中设置值
     * @param employeeId
     */
    public static void setCurrentId(Long employeeId){
        THREAD_LOCAL.set(employeeId);
    }

    /**
     * 提供静态方法在当前本地线程中取值
     * @return
     */
    public static Long getCurrentId(){
       return THREAD_LOCAL.get();
    }

    /**
     * 提供静态方法清理当前线程的数据
     */
    public static void removeCurrentId(){
         THREAD_LOCAL.remove();
    }

}
